<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form>
    <input name="user_name" type="text"><br/>
    <input name="user_trueName" type="text"><br/>
    <input name="user_cardId" type="text"><br/>
    <input name="user_email" type="text"><br/>
    <input name="user_telephone" type="text"><br/>
    <input name="user_qqId" type="text"><br/>
    <input name="user_pwd" type="text"><br/>
    <input name="question" type="text"><br/>
    <input name="answer" type="text"><br/>
    <input name="state" type="text"><br/>
    <input type="button" value="添加" class="buttoncss" id="add">&nbsp;&nbsp;
    <input type="button" value="修改" class="update" id="update">
</form>
<script src="js/jquery-3.3.1.js"></script>

<script type="text/javascript">
    $(function () {
        $("#add").click(function () {

            var user_name= $("[name='user_name']").val();
            var user_trueName=$("[name='user_trueName']").val();
            var user_cardId=$("[name='user_cardId']").val();
            var user_email=$("[name='user_email']").val();
            var user_telephone=$("[name='user_telephone']").val();
            var user_qqId=$("[name='user_qqId']").val();
            var user_pwd=$("[name='user_pwd']").val();
            var question=$("[name='question']").val();
            var answer=$("[name='answer']").val();
            var state=$("[name='state']").val();

            $.ajax({
                type:"post",
                url:"http://localhost:8080/DEMO9_Web_exploded/addUser.do",
                data:{"user_name":user_name,
                    "user_trueName":user_trueName,
                    "user_cardId":user_cardId,
                    "user_email":user_email,
                    "user_telephone":user_telephone,
                    "user_qqId":user_qqId,
                    "user_pwd":user_pwd,
                    "question":question,
                    "answer":answer,
                    "state":state
                },
                success:function (res) {
                    if(res.code==1){
                        alert(res.message);
                        location.href="manageUser.html";
                    }else {
                        alert(res.message)
                    }
                }
            })
        })

        $("#add").click(function () {

            var user_name= $("[name='user_name']").val();
            var user_trueName=$("[name='user_trueName']").val();
            var user_cardId=$("[name='user_cardId']").val();
            var user_email=$("[name='user_email']").val();
            var user_telephone=$("[name='user_telephone']").val();
            var user_qqId=$("[name='user_qqId']").val();
            var user_pwd=$("[name='user_pwd']").val();
            var question=$("[name='question']").val();
            var answer=$("[name='answer']").val();
            var state=$("[name='state']").val();

            $.ajax({
                type:"post",
                url:"http://localhost:8080/DEMO9_Web_exploded/addUser.do",
                data:{"user_name":user_name,
                    "user_trueName":user_trueName,
                    "user_cardId":user_cardId,
                    "user_email":user_email,
                    "user_telephone":user_telephone,
                    "user_qqId":user_qqId,
                    "user_pwd":user_pwd,
                    "question":question,
                    "answer":answer,
                    "state":state
                },
                success:function (res) {
                    if(res.code==1){
                        alert(res.message);
                        location.href="manageUser.html";
                    }else {
                        alert(res.message)
                    }
                }
            })





        })

    })





</script>



</body>
</html>

